<template>

    <div>
        <el-dialog :model-value="dialogVisible" title="企业资金信息" width="700" :close-on-click-modal="false" @close="cls">
            <div style="text-align: center;margin: 30px auto;font-size: 12px;">
                <span>当前企业余额：</span>
                <el-input style="width: 60%;" v-model="money" disabled></el-input>
            </div>

            <el-table :data="gridData" stripe border :header-cell-style="{'text-align':'center','font-size':'14px','color':'#666666','background-color':'#F2F2F2'}" :cell-style="{'text-align':'center','font-size':'12px'}" style="height: 250px;">
                <el-table-column fixed property="createTime" label="账户变动时间" />
                <el-table-column property="reason" label="账户变动原因" />
                <el-table-column property="avaliableMoney" label="可用资金账户" />
                <el-table-column property="freezeMoney" label="冻结资金账户" />
                <el-table-column property="type" label="变动类型" :formatter="statusFormatter" />

            </el-table>

            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="cls">保存</el-button>
                    <el-button @click="cls">不保存关闭</el-button>
                </div>
            </template>
        </el-dialog>
    </div>

</template>



<script setup>
import { ref, reactive } from 'vue'
import { ziJin } from '@/api/platform/enterprise.js'
//属性


//企业资金详情
const money = ref(0) //企业余额
const gridData = ref([])
//声明属性
const props = defineProps({
    "dialogVisible": {
        default: false,
        type: Boolean
    }
})

//声明事件
const emits = defineEmits(["close"])

//方法区

//关闭弹出框
let cls = () => {
    emits("close")
}

//请求方法
let init = async (data) => {
    let res = await ziJin(data)
    if (res.code == 200) {
        gridData.value = res.data.detailList
        money.value = res.data.money
    }
}

//变动类型格式化方法
let statusFormatter = (row, column) => {
    const type = row.type
    if (type == 1) {
        return '系统生成'
    } else if (type == 2) {
        return '续费'
    }
}


//暴露方法
defineExpose({ init })

</script>


<style scope></style>